package kr.saeildamil.androidstudy.ch13;

import kr.saeildamil.androiddforstudy.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
import android.widget.HorizontalScrollView;

public class HScrollViewTest extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch13_hscrollviewtest);
		
		HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.ch13_hscrollviewtest_hscroll);
		hsv.addView(new HColorView(this));
		
	}
}

	class HColorView extends View{
		public HColorView(Context context){
			super(context);
		}
		
		@Override
		protected void onDraw(Canvas canvas) {
			Paint pnt = new Paint();
			for(int i=0; i<2560; i+=10){
				pnt.setARGB(255, 255-i/10, 255-i/10, 255);
				canvas.drawRect(i, 0, i+10, 2560, pnt);
			}
		}
		
		@Override
		protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
			setMeasuredDimension(2560, 2560);
		}
	}
